package cn.gok.homework;

public class Worker {
    private String name;
    private String job; //岗位
    private int salary; //工资

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    public Worker(String name, String job, int salary) {
        this.name = name;
        this.job = job;
        this.salary = salary;
    }

    @Override
    public String toString() {
        return "Worker{" +
                "name='" + name + '\'' +
                ", job='" + job + '\'' +
                ", salary=" + salary +
                '}';
    }

    //工作了months个月，返回总的工资
    public int doJob(int months){
        System.out.println(this.name+"工作了"+months+"个月，获得"+this.salary*months+"工资");
        return this.salary*months;
    }
}